<?php defined('BASEPATH') OR exit('No direct script access allowed');

class reassigned_case extends CI_Controller {

	function __construct()
	{
		parent::__construct();
		if (!$this->ion_auth->logged_in())
		{
			//redirect them to the login page
			redirect('auth/login', 'refresh');
		}
		$this->load->helper(array('form', 'url'));
       	$this->load->model('reassigned_model');
         $this->load->library('datatables');	
        $this->load->library('upload');		 
	}
	
public function reassigned_engineer($id)
{
$data['engineer']=$this->reassigned_model->get_engineer();
$data['case']=$this->reassigned_model->get_case_detail($id)->row();
$meta['page_title'] = ' Assigned Engineer';
	$this->load->view('common/header',$meta);		
	$this->load->view('reassigned_case/assigned_engineer',$data);
	$this->load->view('common/footer');


}	
	
public function engineer_assign()
{
$old_case=$_REQUEST['old_case'];
$this->reassigned_model->old_case_update($old_case);
$insert=array(
    'service_id'=>$_REQUEST['service_id'],
     'enginer_id'=>$_REQUEST['id_engineer'],
	 'status_id' =>1,
	 'date'=>$_REQUEST['assign_date'],
	 'case_id'=>$_REQUEST['case_id'],);

$this->reassigned_model->create_diagnosis($insert);
$this->reassigned_model->update_case($_REQUEST['case_id'],$_REQUEST['id_engineer']);
redirect('/admin/repair/view_reassigned');
}	
	
public function delete_reassigned($id)
{



}	
public function view_reassigned()
{
$meta['page_title'] = ' Assigned Engineer';
$this->load->view('common/header',$meta);		
$this->load->view('reassigned_case/reassigned_case');
$this->load->view('common/footer');


}	
function get_reassigned()
		{
		echo $this->reassigned_model->get_reassigned_view();
		
		}		
public function view_notreassigned()
{
$meta['page_title'] = 'Not assigned';
$this->load->view('common/header',$meta);		
$this->load->view('reassigned_case/not_assigned');
$this->load->view('common/footer');
}	
function get_notreassigned()
		{
		echo $this->reassigned_model->get_notreassigned_view();
		
		}			
	
	
	
	
	}?>